<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS_时间绑定</title>
</head>
<body>
    <!-- 设置两个按钮 -->
    <input type="button" id="bnt1" value="事件绑定1" onclick="on()">
    <input type="button" id="bnt2" value="事件绑定2">
</body>

<script>
    function on(){
        alert("按钮1被点击了")
    }

    document.getElementById("bnt2").onclick=function(){
        alert("按钮2被点击了")
    }
</script>

</html>